<template>
  <el-container>
    <el-header>
      <div style="margin-top: 20px;">
        <el-page-header @back="back">
          <template slot="title">
            返回列表
          </template>
          <template slot="content">
          </template>
        </el-page-header>
      </div>
    </el-header>
    <el-main>
      <h2>错误代码:</h2>
      <h3>{{errorCode}}</h3>
      <h2>错误描述:</h2>
      <h3>{{errorDescription}}</h3>
      <h2>时间:</h2>
      <h3>{{nowTime.format()}}</h3>
    </el-main>
    <el-footer>
    </el-footer>
  </el-container>
</template>
<script>
export default {
  data() {
    return {
      nowTime: new Date(),
      ErrorList: [
        { Code: "400", Description: "系统错误" },
        { Code: "401", Description: "没有权限访问" },
        { Code: "404", Description: "没有相关资源" },
        { Code: "500", Description: "服务器连接错误，请检查网络" },
        { Code: "503", Description: "服务器连接错误" },
      ]
    };
  },
  computed: {
    errorCode() {
      return this.$route.params.code;
    },
    errorDescription() {
      return this.ErrorList.singleOrDefault(
        e => e.Code == this.$route.params.code
      ).Description;
    },
    fromRoutePath() {
      return this.$route.params.from;
    }
  },
  created() {},
  methods: {
    back() {
      this.$router.push(this.fromRoutePath.urlDecode());
    }
  }
};
</script>